#ifndef GAMETD_CORNPROP_H
#define GAMETD_CORNPROP_H

#include <SDL.h>
#include "Timer.h"
#include "Animation.h"
#include "Vector2.h"

class CoinProp {
public:
    CoinProp();
    ~CoinProp() = default;
    void SetPosition(const Vector2 &position);
    const Vector2 &GetPosition() const;
    const Vector2 &GetSize() const;
    void MakeInvalid();
    bool CanRemove();
    void OnUpdate(double delta);
    void OnRender(SDL_Renderer *renderer, SDL_Texture *tex);

private:
    Vector2 position;
    Vector2 velocity;
    Timer timerJump; // 蹦跳的时间
    Timer timerDisappear; // 金币的消失时间
    bool isValid = true;
    bool isJumping = true; // 记录蹦跳状态没有有结束
    double gravity = 490; // 重力
    double intervalJump = 0.75;
    Vector2 size = {16, 16};
    double intervalDisappear = 10;
};

#endif //GAMETD_CORNPROP_H
